package com.sunpy.commonlock.mysql;

import com.sunpy.commonlock.entity.CommonLockEntity;

/**
 * mysql实现分布式锁
 * @author sunpeiyu
 * @date 2023-04-10
 */
public interface IMysqlLockService {
    /**
     * 获取非阻塞的锁
     * @param commonLockEntity
     * @return
     */
    public boolean getUnblockedLock(CommonLockEntity commonLockEntity);

    /**
     * 根据lockId释放锁
     * @param lockId
     * @return
     */
    boolean releaseLockByLockId(String lockId);

    /**
     * 根据lockName释放锁
     * @param lockName
     * @param author
     * @return
     */
    boolean releaseLockByLockName(String lockName, String author);

    /**
     * 根据lockName续期锁
     * @param lockName
     * @param author
     * @return
     */
    boolean renewLockByLockName(String lockName, String author);

    /**
     * 根据lockId续期锁
     * @param lockId
     * @return
     */
    boolean renewLockByLockId(String lockId);


}
